/* 获取角色信息地址 */
import type { postOrPutType } from "@/constants";
import type { IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.ts";
const url = "/back/master-role";
/* 获取角色信息 */
export const getRoleInfo = <T, D>(params?: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url, params);
};

/* 获取我的角色信息 */
export const getMyRoleInfo = <T>(): Promise<IResult<T>> => {
  return getAxios<T>(url + "/my-auth");
};

/* 新增，更新角色信息 */
export const commonRoleInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 删除角色信息 */
export const deleteRole = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};
